﻿<h1>An Introduction of Go</h1>

<p>
Go is a compiled and static typed programming language born from Google.
Many of the core Go design and SDK development team members have many years
of experience in the field of programming language research.
</p>

<div>
Go has many features. Some are unique, some are borrowed from other programming languages:
<ul>
<li>
	built-in concurrent programming support
	<ul>
	<li>
		goroutines (green threads) and start new goroutines easily.
	</li>
	<li>
		channels (based on CSP model) and select mechanisms to do synchronizations between goroutines.
	</li>
	</ul>
</li>
<li>
	the container types <code>map</code> and <code>slice</code> are first-class citizens.
</li>
<li>
	polymorphism through interfaces.
</li>
<li>
	value boxing and reflection through interfaces.
</li>
<li>
	pointers.
</li>
<li>
	function closures.
</li>
<li>
	methods.
</li>
<li>
	deferred function calls.
</li>
<li>
	type embedding.
</li>
<li>
	type deduction.
</li>
<li>
	memory safety.
</li>
<li>
	automatic garbage collection.
</li>
<li>
	great cross-platform compatibility.
</li>
</ul>

Besides the above features, further highlights are:
<ul>
<li>
	The syntax of Go is deliberately designed to be simple, clean,
	and similar to other popular programming languages.
	This makes Go programming easy to pick up.
</li>
<li>
	Go comes with a great set of standard code packages which provide all kinds of
	common functionalities. Most of the packages are cross-platform.
</li>
<li>
	Go also has an active community, and there are
	<a href="https://github.com/avelino/awesome-go">plenty of
	high quality third party Go packages and projects</a> to import and use.
</li>
</ul>

</div>

<p>
Go programmers are often called gophers.
</p>

<p>
In fact, although Go is a compiled and static typed programming language,
Go also has many features which are usually only available in dynamic script languages.
It is hard to combine these two kinds into one language, but Go did it.
In other words, Go owns both the strictness of static languages
and the flexibility of dynamic languages.
I can't say there are not any compromises between the two,
but the effect of the compromises is much weaker than the benefits of the combination in Go.
</p>

<p>
Readability is an important factor which affects the design of Go heavily.
It is not hard for a gopher to understand the Go code written by other gophers.
</p>

<p>
Currently, the most popular Go compiler is written in Go and maintained by the Go design team.
Later we shall call it the standard Go compiler, or <code>gc</code>
(an abbreviation for Go compiler, not for garbage collection GC).
The Go design team also maintains a second Go compiler, <code>gccgo</code>.
Nowadays it's use is less popular than <code>gc</code>, but it always serves as a reference,
and both compilers are in active development.
As of now the Go team focuses on the improvement of <code>gc</code>.
</p>

<p>
<code>gc</code> is provided in the official Go SDK.
Go SDK 1.0 was release in March, 2012.
The version of Go is consistent with the version of Go SDK.
There were/are two major versions released each year.
</p>

<p>
Since the release of Go 1.0, the syntax of Go has changed a little,
but there were/are many improvements for the tools in Go SDK, from version to version,
especially for <code>gc</code>.
For example, noticeable lags caused by garbage collecting is a common
criticism for languages with automatic memory management.
But since Go 1.8, improvements made for the concurrent garbage collection implementation
in <code>gc</code> basically eliminated the lag problem.
</p>

<p>
<code>gc</code> supports cross-platform compilation.
For example, we can build a Windows executable on a Linux OS, and vice versa.
</p>

<p>
Programs written in go language mostly compile very fast.
Compilation time is an important factor for the happiness in development.
Short build time is one reason why many programmers like programming with Go.
</p>

<div>
Advantages of Go executables are:
<ul>
<li>
	small memory footprint
</li>
<li>
	fast code execution
</li>
<li>
	short warm-up duration (so great deployment experience)
</li>
</ul>

Some other compiled languages, such as C/C++/Rust may also have these three advantages
(and they may have their respective advantages compared to Go),
but they lack three important characteristics of Go:
<ul>
<li>
	fast compilation results in happy local development experience
	and short deployment iteration cycles
</li>
<li>
	flexible, like dynamic languages
</li>
<li>
	built-in concurrent programming support
</li>
</ul>
</div>

<p>
All the above advantages combined make Go an outstanding language
and a good choice for many kinds of projects.
Currently, Go is popularly used in network, system tools,
database development and block chain development areas.
Lately more and more embrace Go for building games, big data and AI projects.
</p>

<p>
Finally, Go is not perfect in all aspects.
There are certain trade-offs in Go design.
And the current Go 1 really has some shortcomings.
For example, Go doesn't support generics for custom types and functions now.
Go team members are not against introducing custom generics into Go,
they just haven't found a good solution yet which keeps Go clean and simple.
Go 2 is in planning now. Nothing is impossible in the future.
</p>
